import React, { Component } from "react";
import PropTypes from "prop-types";
import { Form, Input } from "antd";
//添加form组件
const Item = Form.Item;

export default class UpdateForm extends Component {
  formRef = React.createRef();
  static propTypes = {
    categoryName: PropTypes.string.isRequired,
    setForm: PropTypes.func.isRequired,
  };

  render() {
    this.props.setForm(this.formRef);
    //console.log("hyt", this.formRef);
    const { categoryName } = this.props;
    return (
      <Form onFinish={this.onFinish} ref={this.formRef}>
        <Item name="username">
          <Input placeholder="输入分类名称" defaultValue={categoryName} />
        </Item>
      </Form>
    );
  }
}
